import Vue from 'vue';
import Vuex from 'vuex';
import { createVuexPersistedState }  from 'vue-persistedstate'
import state from '@/store/state';
import getters from '@/store/getters';
import mutations from '@/store/mutations';
import actions from '@/store/actions';
import lele from '@/store/modules/lele/lele';
import hanhan from '@/store/modules/hanhan/hanhan';
// 声明使用插件
Vue.use(Vuex);
// 暴露store对象
export default new Vuex.Store({
    state,
    getters,
    mutations,
    actions,
    modules:{
        lele,
        hanhan
    },
    plugins:[
        createVuexPersistedState({
            key:'hahhan',
            storage:window.sessionStorage,
            whiteList:["hanhan"],
            blackList: [],
        })
    ]
})


/* 
vuex存储数据当页面刷新时，数据丢失？如何解决

经常有需求将vuex存储的数据进行持久化存储
localStorage  sessionStorage

vuex-along
vuex-persistedstate

vuex-along
下载npm install vuex-along --save




*/